package com.ssm.service.user;

import com.ssm.dao.UserMapper;
import com.ssm.pojo.User;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;


public class UserServiceImpl implements UserService{

    private UserMapper userMapper;
    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    public UserServiceImpl() {

    }
    @Override
    public User login(User user) {
        return userMapper.getLogin(user);
    }

    @Override
    public int updatePwd(Integer id, String newPwd) throws SQLException {
        return userMapper.updatePwd(id,newPwd);
    }

    @Override
    public boolean loginVerify(String userCode, String userPassword) {
        return false;
    }

    @Override
    public int getUserCount(String userName, Integer userRole) throws SQLException {
        return userMapper.getUserCount(userName, userRole);
    }

    @Override
    public List<User> getUserList(String userName, Integer userRole,int offset, int pageSize){
        return userMapper.getUserList(userName,userRole,offset,pageSize);
    }

    @Override
    public User getUserById(Integer userId) {
        return userMapper.getUserById(userId);
    }

    @Override
    public User getUserByUserCode(String userCode) {
        return userMapper.getUserByUserCode(userCode);
    }

    @Override
    public int addUser(User user){
        return userMapper.addUser(user);
    }

    @Override
    public int deleteUserById(Integer userId) throws SQLException {
        return userMapper.deleteUserById(userId);
    }

    @Override
    public int modifyUser(User user) throws SQLException {
    return userMapper.modifyUser(user);
    }
}
